<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions">
    <ui:composition template="/layout/masterpage_admin.xhtml">
          <f:metadata>
            
              <f:event type="preRenderView" listener="#{sys_NguoiDungController.onPageLoad_CheckAdmin()}">
                
            </f:event>
        </f:metadata>
         <ui:define name="ui-header">
             <title>#{utilsController.getLanguages("DichVuNganHang")}</title>
        </ui:define>
        
        
        <ui:define name="ui-content">
            
            <h:form id="frmtuvanchovay">
                
                <c:set var="vNganHang" value="#{c_TuVanChoVayController.findAllNganHang()}" scope="session"/>
                <c:set var="vtuvanchovay" value="#{c_TuVanChoVayController.findAllTuVanChoVay()}" scope="session"/>
                <div class="row">
                    <div class="col-md-3">
                        <div class="btn-group">
                            <a href="/Admin/c/bankservice/new.html" class="btn btn-default">#{utilsController.getLanguages("TaoMoi")}</a>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <select  id="cboNganHangID" class="form-control" onchange="cboNganHangID_changed();">
                            <c:forEach items="#{vNganHang}" var="item">
                                <option value="#{item.getID()}">#{item.getTenNH()}</option>
                            </c:forEach>
                        </select>
                    </div>
                    
                </div>
                

                 <div class="panel panel-sea margin-bottom-40">
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-edit"></i>#{utilsController.getLanguages("tuvanchovay")}</h3>
                    </div>
                     <p:outputPanel id="pnTuVanChoVay">
                           <table class="table table-striped">
                                <thead>
                                    <tr>
                                        <th>#{utilsController.getLanguages("ID")}</th>
                                        <th>#{utilsController.getLanguages("NganHang")}</th>
                                        <th>#{utilsController.getLanguages("Loai")}</th>
                                        <th>#{utilsController.getLanguages("LaiXuat")}</th>
                                        <th>#</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <c:forEach items="#{vtuvanchovay}" var="item">
                                        <tr>

                                            <td>#{item.getID()}</td>
                                             <td>#{item.getNganHang()}</td>
                                              <td>#{item.getLoaiVN()}</td>
                                              <td>#{utilsController.formatNumber(item.getLaiXuat(), "#,###.##")}</td>
                                              <td>
                                                  <button class="btn btn-primary btn-xs" type="button" onclick="Update_tuvanchovay_Click('#{item.getID()}');"><i class="fa fa-truck-o"></i> #{utilsController.getLanguages("Update")}</button>
                                                  <button class="btn btn-danger btn-xs" onclick="Delete_tuvanchovay_Click('#{item.getID()}','#{utilsController.getLanguages('CoChacBanMuonXoaDuLieu')}');" type="button"><i class="fa fa-trash-o"></i> #{utilsController.getLanguages("Delete")}</button>

                                              </td>
                                        </tr>

                                    </c:forEach>


                                </tbody>
                            </table>
                     </p:outputPanel>
                  
                </div>
                <p:remoteCommand name="Delete_tuvanchovay" actionListener="#{c_TuVanChoVayController.btnDelete_Click}" update=":frmtuvanchovay"></p:remoteCommand>
                <p:remoteCommand name="Update_tuvanchovay" actionListener="#{c_TuVanChoVayController.btnUpdate_Click}" update=":frmtuvanchovay"></p:remoteCommand>
                
                <p:remoteCommand name="select_tuvanchovay" actionListener="#{c_TuVanChoVayController.btnNganHangID_Click}" update=":frmtuvanchovay:pnTuVanChoVay"></p:remoteCommand>
            </h:form>
        </ui:define>
    </ui:composition> 
</html>